﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ServiceModel;
using Teenusekiht;

public partial class Account_Register : System.Web.UI.Page
{

    protected void Page_Load(object sender, EventArgs e)
    {
        RegisterUser.ContinueDestinationPageUrl = Request.QueryString["ReturnUrl"];
    }

    protected void RegisterUser_CreatedUser(object sender, EventArgs e)
    {
        FormsAuthentication.SetAuthCookie(RegisterUser.UserName, false /* createPersistentCookie */);

        string continueUrl = RegisterUser.ContinueDestinationPageUrl;
        if (String.IsNullOrEmpty(continueUrl))
        {
            continueUrl = "~/";
        }
        Response.Redirect(continueUrl);
    }

    protected void RegisterUser_CreatingUser(object sender, LoginCancelEventArgs e)
    {
        string userName = RegisterUser.UserName;
        string pass = RegisterUser.Password;
        IService1 sc = new ChannelFactory<IService1>("Serv").CreateChannel();
        //int userRoleID = 1;
        //bool success = sc.RegistreeriKasutaja(userName, pass, userRoleID); 
        sc.Dispose();
    }

    protected void RegisterUser_CreateUserError(object sender, CreateUserErrorEventArgs e)
    {
        System.Diagnostics.Debug.Print(" RegisterUser_CreateUserError() ");

    }

}
